package cn.wanghaomiao.dao;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;
import cn.wanghaomiao.model.BlogContent;
import cn.wanghaomiao.model.HouseInfo_58;
import cn.wanghaomiao.model.HouseInfo_ganji;

/**
 * @author 汪浩淼 [et.tw@163.com]
 * @since 2015/10/30.
 */
@DAO
public interface StoreToDbDAO {
    @ReturnGeneratedKeys
    @SQL("insert into blog (title,content,update_time) values (:1.title,:1.content,now())")
    public int save(BlogContent blog);

    @ReturnGeneratedKeys
    @SQL(
            "insert into "
            + "houseInfo_58 ("
                + "title,price,downPayment,monthlyPayment,houseType,"
                + "position,address,contacter,phoneNumber,"
                + "houseForm,fitment,houseProperty,houseStructure,"
                + "buildingAge,houseFloor,equity,aspect,"
                + "description,href,update_time"
            + ")"
            + "values ("
                + ":1.title,:1.price,:1.downPayment,:1.monthlyPayment,:1.houseType,"
                + ":1.position,:1.address,:1.contacter,:1.phoneNumber,"
                + ":1.houseForm,:1.fitment,:1.houseProperty,:1.houseStructure,"
                + ":1.buildingAge,:1.houseFloor,:1.equity,:1.aspect,"
                + ":1.description,:1.href,now()"
            + ")"
        )
    public int save(HouseInfo_58 house);

    @ReturnGeneratedKeys
    @SQL(
            "insert into "
            + "houseInfo_ganji ("
                + "title,price,houseType,survey,"
                + "houseFloor,area,region,address,"
                + "contacter,phoneNumber,"
                + "description,href,update_time"
            + ")"
            + "values ("
                + ":1.title,:1.price,:1.houseType,:1.survey,"
                + ":1.houseFloor,:1.area,:1.region,:1.address,"
                + ":1.contacter,:1.phoneNumber,"
                + ":1.description,:1.href,now()"
            + ")"
        )
    public int save(HouseInfo_ganji house);
}
